<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width, initial-scale=1.0" />
		<title></title>
		<link rel="stylesheet" href="css/mui.min.css" />
		<script src="examples/best-practices/list-to-detail/vue.min.js" type="text/javascript" charset="utf-8"></script>
		<style>
			.layout{
				height: 3000px;
			}
			#getTop{
				opacity: 0;
			}
		</style>
	</head>
	<body>
		<div id="root">
			<header class="mui-bar mui-bar-nav">
				<h1 class="mui-title">首页</h1>
			</header>
			
			<div class="mui-content layout">
				<div style="padding: 10px;">
					<div ref="sld" id="slider" class="mui-slider" >
					  <div class="mui-slider-group mui-slider-loop">
						<!-- 额外增加的一个节点(循环轮播：第一个节点是最后一张轮播) -->
						<div class="mui-slider-item mui-slider-item-duplicate">
						  <a href="#">
							<img src="images/images/banner3.jpg">
						  </a>
						</div>
						<!-- 第一张 -->
						<div class="mui-slider-item">
						  <a href="#">
							<img src="images/images/banner1.jpg">
						  </a>
						</div>
						<!-- 第二张 -->
						<div class="mui-slider-item">
						  <a href="#">
							<img src="images/images/banner2.jpg">
						  </a>
						</div>
						<!-- 第三张 -->
						<div class="mui-slider-item">
						  <a href="#">
							<img src="images/images/banner3.jpg">
						  </a>
						</div>
						<!-- 额外增加的一个节点(循环轮播：最后一个节点是第一张轮播) -->
						<div class="mui-slider-item mui-slider-item-duplicate">
						  <a href="#">
							<img src="images/images/banner1.jpg">
						  </a>
						</div>
					  </div>
					  <div re class="mui-slider-indicator">
						<div class="mui-indicator mui-active"></div>
						<div class="mui-indicator"></div>
						<div class="mui-indicator"></div>
					  </div>
					</div>
				</div>
			</div>
			
			<button ref="getTopBtn" @click="getTop" type="button" class="mui-btn mui-btn-blue" style="width: 50px;height: 50px;border-radius: 50%;position: fixed;bottom: 70px;right: 20px;">顶</button>
			
		</div>
		
		<script src="js/mui.js" type="text/javascript" charset="utf-8"></script>
		<script>
			new Vue({
				el:'#root',
				data(){
					return{}
				},
				mounted(){
					let slider= this.$refs.sld
					let gt = this.$refs.getTopBtn
					window.addEventListener('scroll',function(){
						let bHeigt = document.body.clientHeight
						slider.style.opacity = (slider.clientHeight-window.pageYOffset)  /  (window.pageYOffset+slider.clientHeight)
						gt.style.opacity = window.pageYOffset/(bHeigt-window.innerHeight)
					})
				},
				methods: {
					getTop() {
						window.scroll({
							top:0,
							behavior:'smooth'
						})
					}
				},
			})
			
		</script>
	</body>
</html>